<script setup lang="ts">
import { useResourceStore } from '@/stores/useResource'
import { timeFormatter } from '@/utils/timeHandlers'
const useResource = useResourceStore()
</script>
<template>
  <div class="container">
    <el-card class="box-card">
      <template #header>
        <div class="card-header">
          <h2>资源类别列表</h2>
          <el-button type="primary" @click="$router.push('/resources')"> 返回</el-button>
        </div>
      </template>
      <el-table :data="useResource.allResourcesCategory" border style="width: 100%">
        <el-table-column type="index" label="编号" width="80" align="center" />
        <el-table-column prop="name" label="类别名称" align="center" />
        <el-table-column prop="createdTime" label="创建时间" :formatter="timeFormatter" align="center" />
        <el-table-column prop="sort" label="排序" align="center" />
        <el-table-column label="操作" align="center">
          <el-button type="primary"> 编辑</el-button>
          <el-button type="danger">删除</el-button>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>
<style scoped lang="scss">
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
</style>
